// #include "./brute_force.cpp"
#include "./kmp.cpp"

int main(int argc, const char **argv)
{
    char str[] = "abcbaababcabababcaababccbbabb";
    char pattern[] = "abcaababcc";

    int index = Strpos(str, pattern);
    printf("[matched] %d\n", index);
    if (index == -1)
    {
        return 0;
    }
    for (int m = 0; m <= index; m++)
    {

        if (m == index)
        {
            printf(" ⬇ ");
        }
        else
        {
            printf("   ");
        }
    }
    printf("\n");
    for (int m = 0; m < StrLen(str); m++)
    {
        printf("%2d ", m);
    }
    printf("\n");
    for (int m = 0; m < StrLen(str); m++)
    {
        printf(" %c ", str[m]);
    }
    printf("\n");
    for (int m = 0; m < StrLen(str); m++)
    {
        if (m < index || m >= index + StrLen(pattern))
        {
            printf("   ");
        }
        else
        {
            printf(" %c ", str[m]);
        }
    }
    printf("\n");
    return 0;
}